<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" />
    <link rel="stylesheet" href="css/Site.css" />
    <link rel="stylesheet" href="css/zy.all.css" />
    <link rel="stylesheet" href="css/font-awesome.min.css" />
    <link rel="stylesheet" href="css/amazeui.min.css" />
    <link rel="stylesheet" href="css/admin.css" />
    <!--		在标题栏的左侧显示图标 href:图标地址-->
    <link rel="icon" href="images/logo/favicon.ico" type="image/x-icon">
    <!--		在收藏夹里面显示图标 href:图标地址-->
    <link rel="shortcut icon" href="images/logo/favicon.ico" type="image/x-icon">
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">

        //页面加载的时候 异步的方式加载下拉框
        $(function () {
            $.ajax({
                url:"type_all",
                type:"post",
                dataType:"json",
                success:function (result) {
                    //alert(JSON.stringify(result));
                    for(var i=0;i<result.length;i++){
                        $("#productType").append("<option value='"+result[i].tid+"'>"+result[i].tname+"</option>")
                    }
                    //设置下拉框选中
                    $("#productType").val([[${product.type.tid}]]);
                }
            });
        });

    </script>
</head>
<body>
<div class="dvcontent">

    <div>
        <!--tab start-->
        <div class="tabs">
            <div class="hd">
                <ul>
                    <li class="on" style="box-sizing: initial;-webkit-box-sizing: initial;">修改商品</li>
                </ul>
            </div>

            <div class="am-cf admin-main" style="padding-top: 0px;display: block;">
                <!-- content start -->
                <div class="admin-content">
                    <div class="admin-content-body">

                        <div class="am-g">
                            <div class="am-u-sm-12 am-u-md-4 am-u-md-push-8">

                            </div>
                            <div class="am-u-sm-12 am-u-md-8 am-u-md-pull-4"
                                 style="padding-top: 30px;">
                                <form class="am-form am-form-horizontal" action="product_update" method="post" enctype="multipart/form-data">
                                    <div class="am-form-group">
                                        <label for="ptitle" class="am-u-sm-3 am-form-label">
                                            商品名称</label>
                                        <div class="am-u-sm-9">
                                            <input type="hidden" name="pid" th:value="${product.pid}"/>
                                            <input type="text" id="ptitle" required placeholder="商品名称" name="ptitle" th:value="${product.ptitle}">
                                            <small>10字以内...</small>
                                        </div>
                                    </div>

                                    <div class="am-form-group">
                                        <label for="price" class="am-u-sm-3 am-form-label">
                                            商品价格</label>
                                        <div class="am-u-sm-9">
                                            <input type="text" id="price" required
                                                   placeholder="商品价格" name="price" th:value="${product.price}">
                                            <small>...</small>
                                        </div>
                                    </div>

                                    <div class="am-form-group">
                                        <label for="pimage" class="am-u-sm-3 am-form-label">
                                            商品图片</label>
                                        <div class="am-u-sm-9">
                                            <img th:src="${product.pimage}" width="10%"/>
                                            <input type="hidden" name="pimage" th:value="${product.pimage}"/>
                                            <input type="file" id="pimage" placeholder="商品图片" name="file">
                                            <small>...</small>
                                        </div>
                                    </div>

                                    <div class="am-form-group">
                                        <label for="productType" class="am-u-sm-3 am-form-label">
                                            分类</label>
                                        <div class="am-u-sm-9">
                                            <select required id="productType" name="type.tid">
                                                <option value="-1">请选择分类</option>
                                            </select>
                                            <small>群组</small>
                                        </div>
                                    </div>
                                    <div class="am-form-group">
                                        <label for="user-intro" class="am-u-sm-3 am-form-label">
                                            备注</label>
                                        <div class="am-u-sm-9">
									<textarea class="" rows="5" id="user-intro"
                                              placeholder="输入备注" th:text="${product.premark}" name="premark"></textarea>
                                            <small>250字以内...</small>
                                        </div>
                                    </div>
                                    <div class="am-form-group">
                                        <div class="am-u-sm-9 am-u-sm-push-3">
                                            <input type="submit" class="am-btn am-btn-success" value="修改商品" />
                                            <input type="button" class="am-btn am-btn-success" value="返回列表" onclick="javascript:history.back();"/>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>

                </div>
                <!-- content end -->
            </div>
            <!--添加 end-->
            </ul>
        </div>
    </div>
    <!--tab end-->

</div>


<script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="js/plugs/Jqueryplugs.js" type="text/javascript"></script>
<script src="js/_layout.js"></script>
<script src="js/plugs/jquery.SuperSlide.source.js"></script>

</div>
</body>

</html>